﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SMS.Windows.Forms;
using LibraryONTrack.BAL;

namespace LibraryONTrack.UI
{
	public partial class AgeNoticesPage : SMS.Windows.Forms.InteriorWizardPage
	{
        OverdueBookManager bookManager;

		public AgeNoticesPage()
		{
			InitializeComponent();
		}

		protected override bool OnSetActive()
		{
			if (!base.OnSetActive())
				return false;

			// Enable both the Next and Back buttons on this page    
			Wizard.SetWizardButtons(WizardButton.Back | WizardButton.Next);
			return true;
		}

        private void AdvanceNoticeButton_Click(object sender, EventArgs e)
        {
            bookManager = new OverdueBookManager();
            bookManager.AdvanceNotice();
        }

        private void RetractNoticeButton_Click(object sender, EventArgs e)
        {
            bookManager = new OverdueBookManager();
            bookManager.RetractNotice();
        }

        private void AcceptUpdateButton_Click(object sender, EventArgs e)
        {
            bookManager = new OverdueBookManager();
            //purge books that have been returned
            bookManager.PurgeReturnedBooks();
            //sets the still_overdue_ind to false for remaining overdue books
            bookManager.SetStillOverdueInd();
        }
	}
}
